<template>
<div>
  <h1>展示校区</h1>
  <table border="1" cellspacing="0" align="center">
    <tr>
      <td>学校名称</td>
      <td>学校说明</td>
      <td>操作</td>
    </tr>
    <tr v-for="i in schoollist">
      <td>{{i.name}}</td>
      <td>{{i.state}}</td>
      <td>
        <button></button>
      </td>
    </tr>
  </table>

  <h1>添加校区</h1>
  <p>校区名称:<input type="text" v-model="form.name"></p>
  <p>校区说明:<input type="text" v-model="form.state"></p>
  <button @click="add">添加</button>
</div>
</template>

<script>
export default {
  name: "School_show",
  data(){
    return{
      form:{},
      schoollist:{},
    }
  },
  methods:{
    get_schoollist(){
      this.$axios.get('users/schoolm/')
      .then(res=>{
        this.schoollist=res.data.list
      })
    },
    add(){
      this.$axios.post('users/schoolm/',this.form)
      .then(res=>{
        console.log(res.data)
      })
    },
  },
  mounted() {
    this.get_schoollist()
  }
}
</script>

<style scoped>

</style>
